package com.lagou.edu.course;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;

import lombok.extern.slf4j.Slf4j;

@SpringBootApplication
@EnableDiscoveryClient
@MapperScan("com.lagou.edu.course.mapper")
@EnableFeignClients("com.lagou.edu")
@Slf4j
public class LagouCourseApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(LagouCourseApplication.class, args);
        System.out.println("服务启动完成，当前环境为：" + run.getEnvironment().getProperty("env"));
    }

    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor page = new PaginationInterceptor();
        page.setDbType(DbType.MYSQL);
        return page;
    }

}
